package com.mhc.suzuki.constant;

/**
 * 审批结果枚举类
 * Created by kanon on 2017/8/29.
 */
public enum ApprovalResultEnum {

    //不通过
    REJECT(0, "不通过"),
    PASS(1, "通过"),
    SUBMITSUPERIOR(2, "提交上级"),
    PARTPASS(3, "附条件通过");


    private Integer code;
    private String name;

    ApprovalResultEnum(Integer code, String name){
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }


    /**通过code值得出name**/
    public static ApprovalResultEnum getApprovalResultEnum(Integer code) {
        for (ApprovalResultEnum approvalResultEnum : ApprovalResultEnum.values()) {
            if (approvalResultEnum.code.equals(code)) {
                return approvalResultEnum;
            }
        }
        return null;
    }


    public static String getNameByCode(Integer code){
        for(ApprovalResultEnum item : ApprovalResultEnum.values()){
            if(item.getCode().equals(code)){
                return item.getName();
            }
        }
        return "";
    }

}
